import cv2
import numpy as np
if __name__ == '__main__':
    path = 'work3.png'
    image_np = cv2.imread(path)
    image_np_hsv = cv2.cvtColor(image_np, cv2.COLOR_BGR2HSV)
    blue_low = np.array([110, 43, 146])
    blue_high = np.array([124, 255, 255])
    mask_blue = cv2.inRange(image_np_hsv, blue_low, blue_high)

    orange_low = np.array([11, 43, 46])
    orange_high = np.array([25, 255, 255])
    mask_orange = cv2.inRange(image_np_hsv, orange_low, orange_high)

    mask = cv2.bitwise_or(mask_blue, mask_orange)
    color_image_np = cv2.bitwise_and(image_np, image_np, mask=mask)


    cv2.imshow('', color_image_np)
    cv2.waitKey(0)
    cv2.imwrite('zuoye3.jpg', color_image_np)